home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4440 < prev    next >
Encoding:
Text File  |  1996-08-06  |  911 b   |  31 lines

  1. Newsgroups: comp.lang.c++
  2. Path: leeds.ac.uk!news
  3. From: H.Lawson@tees.ac.uk (Hamish Lawson)
  4. Subject: Cast from function expecting a reference to one expecting a pointer
  5. Message-ID: <310DF504.69E6@tees.ac.uk>
  6. X-Mailer: Mozilla 2.0b6a (Win95; I)
  7. Content-Type: text/plain; charset=us-ascii
  8. Organization: University of Teesside
  9. MIME-Version: 1.0
  10. Date: Tue, 30 Jan 1996 10:37:12 +0000 (GMT)
  11. Content-Transfer-Encoding: 7bit
  12.  
  13. Is it legal to cast from a function which expects a reference to one 
  14. expecting a pointer, as in the sample code below.
  15.  
  16.  
  17.    void somefunc(sometype &n);
  18.  
  19.    typedef void (*funcptr)(sometype *);
  20.    ...
  21.       sometype x, *p = &x;
  22.       funcptr f = (funcptr) somefunc;
  23.       f(x);
  24.       f(p);
  25.  
  26.  
  27. | Hamish Lawson, School of Computing and Mathematics, 
  28. | University of Teesside, Middlesbrough, Cleveland, UK, TS1 3BA 
  29. | Tel: +44 1642 218121 x3611  Fax: +44 1642 342604
  30. | E-mail: H.Lawson@tees.ac.uk
  31.